Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RichTextEditor): format toolbar [WPB-12089] #18398

Merged
merged 36 commits into from
Dec 16, 2024
Merged

Conversation

olafsulich
Copy link
Contributor

@olafsulich olafsulich commented Nov 29, 2024

StoryWPB-12089 [Web] Text formatting via UI in text input field

Description

A new rich text editor that allows users to edit their message visually before sending it, contains options: heading (h1), bold, italic, strikethrough, lists (ordered & unordered), and code.

Figma Designs

What's changed?

  • added the format toolbar which activates after the "show formatting" button, it's behind a flag
  • added the emoji picker modal, same as for message reactions, also behind a flag
  • added the strikethrough option for the markdown renderer, change how inline code is displayed (with background)
  • small refactoring, moved files around, created some components
  • changed avatar to be visible all the time (behind flag), not only when typing
  • changed the order of action buttons (pick image/file, ping, etc.) as it's on design

What's missing?

Tests. It turned out, that testing the Lexical-related code isn't simple. It's because of the poor support for the contenteditable in JSDOM (issue no.1, and no.2), and lack of other utilities from the Lexical itself, more info. We will add end-to-end tests with QA guidance to ensure the feature works properly.

Screenshots/Screencast (for UI changes)

Text formatting:

Screen.Recording.2024-12-03.at.08.01.05.mov

Message editing:

Screen.Recording.2024-12-03.at.08.03.51.mov

Message editing (rich, long):

Screen.Recording.2024-12-04.at.10.24.51.mov

Inserting emoji:

Screen.Recording.2024-12-03.at.08.04.52.mov

Reply to message preview:

Screen.Recording.2024-12-04.at.10.20.37.mov

Default view, large viewport:

image

Default view, small viewport:

image

Rich text view, large viewport:

image

Rich text view, small viewport:

image

Checklist

  • mentions the JIRA issue in the PR name (Ex. WPB-423)
  • PR has been self reviewed by the author;
  • Hard-to-understand areas of the code have been commented;
  • If it is a core feature, unit tests have been added;

@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 35.26570% with 134 lines in your changes missing coverage. Please review.

Project coverage is 46.19%. Comparing base (836ba5c) to head (a968f41).
Report is 4 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #18398      +/-   ##
==========================================
- Coverage   46.27%   46.19%   -0.09%     
==========================================
  Files         845      861      +16     
  Lines       26432    26593     +161     
  Branches     5995     6022      +27     
==========================================
+ Hits        12232    12284      +52     
- Misses      12665    12770     +105     
- Partials     1535     1539       +4     

@olafsulich olafsulich marked this pull request as ready for review December 4, 2024 07:29
@olafsulich olafsulich requested review from otto-the-bot and a team as code owners December 4, 2024 07:29
>
<ul
className={cx('controls-right buttons-group input-bar-buttons', {
'controls-right-shrinked': textValue.length !== 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'controls-right-shrinked': textValue.length !== 0,
'controls-right-shrinked': !!textValue.length,

Comment on lines +606 to +611
onEscape={() => {
if (editedMessage) {
cancelMessageEditing(true);
} else if (replyMessageEntity) {
cancelMessageReply();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe extract to a function

export const FormatTextButton = ({isActive, onClick}: FormatTextButtonProps) => {
return (
<button
className={cx(`controls-right-button buttons-group-button-left`, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
className={cx(`controls-right-button buttons-group-button-left`, {
className={cx('controls-right-button buttons-group-button-left', {

@olafsulich olafsulich merged commit 25d4950 into dev Dec 16, 2024
11 checks passed
@olafsulich olafsulich deleted the feat/rich-message-editor branch December 16, 2024 06:32
@paulwire paulwire added the echoes: product-roadmap/feature Work contributing to adding a new feature as part of the product roadmap. label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: product-roadmap/feature Work contributing to adding a new feature as part of the product roadmap. 👕 size: XXL type: feature / request ✨
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants